package com.hsylient.javase.chapter05.demo12;


import com.hsylient.javase.common.entity.StudentSerializable;
import lombok.SneakyThrows;
import org.junit.Test;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

public class MyObjectOutputStream implements Serializable {

    @Test
    @SneakyThrows
    public void testInput() {
        StudentSerializable hsylient = new StudentSerializable("hsylient", 22, 10001);
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream("student.txt"));
        objectOutputStream.writeObject(hsylient);
        objectOutputStream.flush();
        objectOutputStream.close();
    }
}
